<?php
/**
 * Created by PhpStorm.
 * User: zouhua
 * Date: 2017/5/5
 * Time: 16:19
 */

namespace app\actions;


use app\models\Activity;

class UserPublish extends UserList {

    public $title = '我的发布';

    public function beforeRun() {
        if (!parent::beforeRun()) {
            return FALSE;
        }
        $this->modelClass = Activity::className();
        $this->where = ['uid' => $this->user->id];
        $this->orderBy = 'status asc, id desc';

        $this->layout = 'user';
        return TRUE;
    }

    public function render($params = [], $view = NULL) {
        $this->controller->view->title = $this->title;
        if (!isset($params['user'])) {
            $params['user'] = $this->user;
        }
        $view = str_replace('_ajax', '', $view);
        return $this->controller->render($params, $view);
    }
}